package top.kinix.homework01;

import java.math.BigInteger;

public class Calc {
    public static double add(double a, double b) {
        return a + b;
    }

    public static double substract(double a, double b){
        return a - b;
    }

    public static double multiply(double a, double b){
        return a * b;
    }

    public static double divide(double a, double b){
        double result;
        if (b == 0) {
            result = 0.0;
        }else{
            result = a / b;
        }
        return result;
    }

    public static void echo(double a, double b, char symb) {
        switch (symb) {
            case '+' : System.out.println(add(a, b));break;
            case '-' : System.out.println(substract(a, b));break;
            case '*' : System.out.println(multiply(a, b));break;
            case '/' : if (divide(a, b) == 0.0) {
                System.out.println("除数不能为0！");
            }else {
                System.out.println(divide(a, b));
            }
        }
    }
}
